package com.xjy.headfirst.观察者模式;
/**
 * @author     :辛纪元
 * @date       :2022-06-08 21:54
 * @description:具体实现天气类
 */

public class CurrentConditionDisplay implements Observer,DisplayElement{

    private String name;

    private int age;

    public CurrentConditionDisplay(Subject subject){
        subject.registerObserver(this);
    }

    @Override
    public void display() {
        System.out.println("CurrentConditionDisplay展示name："+name+",age:"+age);
    }

    @Override
    public void update(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
